<?php

class Core_Frontend_Module_Article_Content extends Dcmp_Module_Base {

    protected $name = 'article_content';

    public function install() {

    }

    public function uninstall() {

    }

    public function buildConfig($form) {
        $form->addTextBoxField($this->__('article.label.article_id'), 'article_id', 'module[parameters][dynamic][article_id]',TRUE);
        $form->createTab('module_option', $this->__('design.label.dynamic_parameter'),
                array('field_article_id'));
    }

    public function render() {
        $content = $this->getVariables()->getData('article_object');
        if(!$content){
            $contentId = $this->getDynamicParameter('id');
            if(!$contentId){ $contentId = 1;}
            Kd_Web::getVariables()->setData('content_id',$contentId);
            $content = App::getModel('article/content')->load($contentId)->updateClickCount();
        }
        $tmpl = $this->getTemplate()->assignMulti(array('content' => $content,'pageindex' => 1));
        return $tmpl->render($this->getTemplatePath($this->getValueByKey('template_name'),$this->getValueByKey('template_script')));
    }

}